<?php
/**
 * 后台登录模型
 * User: EDZ
 * Date: 2020/12/19
 * TIME: 15:40
 */
namespace app\admin_product_libaray\admin_user_module\model;

use think\Model;

class UserInfoModel extends Model {

    public $name = 'admin_user';

    /**
     * 获取某个账号的信息
     *
     * @param $uid
     * @return array|\PDOStatement|string|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function getUserInfo($uid){
        return self::where(['id' => $uid])->find();
    }

    /**
     * 登录时获取信息
     *
     * @param $username
     * @param $password
     * @return array|\PDOStatement|string|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function getLoginUserInfo($username,$password){
        return self::where(['username' => $username,'password' => $password])->find();
    }
}